import React, { Component } from 'react';
import { connect } from 'react-redux';

class Number extends Component {
    state = {}
    
    handleClick = () => {
        this.props.concat("xjj");
    }
    render() { 
        console.log(this.props);
        return (
            <React.Fragment>
            <h3>Number:</h3>                
                <div>{this.props.number}</div>   
                <button onClick={this.handleClick}>添加</button>
            </React.Fragment>
        );
    }
}
 
const mapStateToProps = (state) => {
    return {
        number: state.number,
    }
}

const mapDispatchToProps = {
    concat: (xjj) => {
        return {
            type: "concat",
            character: "xjj",
        }
    }
}

export default connect(mapStateToProps,mapDispatchToProps)(Number);